<?php
    $url = new Url();
    $arr_region = LoadConfig::$region;
?>
<script type="text/javascript">

    loadBoxSearch();

    $(document).ready(function(){

        $('#mientrung').addClass('active');
        $('#ketqua').addClass('active');

        loadChat("<?=$url->createUrl('home/chat')?>");

        $(".boxCalendar").datepicker({
            dateFormat: 'yy-mm-dd',
            showOn: 'both',
            buttonImage: ' <?php echo Yii::app()->params['static_url'];?>/images/xo-so-10h-icon-LMT.png',
            buttonImageOnly: true,
        });

        $( "#ngay" ).datepicker({ dateFormat: 'yy-mm-dd' });

        $('.From').keypress(function(e){
            if(e.keyCode == 13 && !e.shiftKey){
                $(this).trigger("enterKey");
            } 
        });

        $('textarea').bind("enterKey",function(e){
            var messenger = $('.From').val();
            var url = "<?=$url->createUrl('home/chat'); ?>";
            $.ajax({
                type: "GET",
                url: url,
                global: false,
                data: {
                    messenger: messenger,
                },
                success: function(msg){  
                    if(msg==1){
                        alert('Bạn phải đăng nhập để tán gẫu');
                    }
                    if(msg==0){
                        alert('Bạn phải chưa nhập nội dung');
                    }
                    else
                    {
                        $("#CHAT").html(msg);
                        $('.From').val('');
                    }

                }
            });
        });

        var currentdate = new Date(); 
        var datetime = currentdate.getFullYear() + "/" + (currentdate.getMonth()+1)  + "/" + (currentdate.getDate()) + " 17:15:00";
        $('.count').countdown(datetime, function(event) {
            $(this).html(event.strftime('%H:%M:%S'));
        });

    });

    function messenger(){
        var messenger = $('.From').val();
        var url = "<?=$url->createUrl('home/chat'); ?>";
        $.ajax({
            type: "GET",
            url: url,
            global: false,
            data: {
                messenger: messenger,
            },
            success: function(msg){
                if(msg==1){
                    alert('Bạn phải đăng nhập để tán gẫu');
                }
                if(msg==0){
                    alert('Bạn phải chưa nhập nội dung');
                }
                else
                {
                    $("#CHAT").html(msg);
                    $('.From').val('');
                }
            }
        });
    };

    function loadChat(url,scroll1){
        var scroll = $('.boxCHAT').scrollTop();
        //alert(scroll);
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{
                scroll: scroll,
                scroll1: scroll1,
            },
            success:function(msg){
                $("#CHAT").html(msg);
            }
        });
    }

    function inketqua(region,date){
        var name = prompt("Tên đại lý");
        window.open('<?php echo $url->createUrl('home/inketqua');?>?region='+region+'&date='+date+'&name='+name);
    }

    function loadBoxSearch(){
        var url = "<?=$url->createUrl('home/boxsearch');?>";
        $.ajax({
            type: "POST",
            url: url,
            global: false,
            data:{},
            success: function(msg){
                $("#boxsearch").html(msg);
            }
        });
    }

</script>

<div class="leftMain">
    <div class="menuXS">
        <ul>
            <li id="mienbac"><a href="<?php echo Yii::app()->createUrl('ketqua/mienbac')?>">XỔ SỐ MIỀN BẮC</a></li>
            <li id="mientrung"><a href="<?php echo Yii::app()->createUrl('ketqua/mientrung')?>"><h1>XỔ SỐ MIỀN TRUNG</h1></a></li>
            <li id="miennam"><a href="<?php echo Yii::app()->createUrl('ketqua/miennam')?>">XỔ SỐ MIỀN NAM</a></li>
            <li id="dientoan"><a href="<?php echo Yii::app()->createUrl('ketqua/dientoan')?>">XỔ SỐ ĐIỆN TOÁN</a></li>
        </ul>
    </div>

    <div class="Calendar">
        <div>
            <form method="GET" action="<?php echo Yii::app()->createUrl('ketqua/ketquamientrung');?>">
                <a href="javascript:void(0);">
                    <input type="text" name="date" class="boxCalendar" value="<?php echo $data1['ngay_quay']; ?>" style="text-align: center;">
                    <input type="submit" value="Tìm kiếm" class="button_KQ">
                </a>
            </form>
        </div>
        <div class="arrowCalendar_1">
            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquamientrung',array('last'=>$data1['ngay_quay']))?>"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrowlich.png" style="padding-top:14px;"/></a>
        </div>
        <div class="arrowCalendar_2">
            <a href="<?php echo Yii::app()->createUrl('ketqua/ketquamientrung',array('next'=>$data1['ngay_quay']))?>"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-arrowlich2.png" style="padding-top:14px;"/></a>
        </div>
    </div>

    <div class="XSMN">
        <div class="titleXSMN">
            Kết quả sổ xố trực tiếp miền Trung ngày <span class="red"><?php echo date('d/m/Y',strtotime($data1['ngay_quay'])); ?></span>
            <p>Đang chờ<span class="red"> KQXS Miền Trung</span> lúc 17h15 - <?php echo date('d/m/Y'); ?>. Còn <span class="count"></span></p>
        </div>
        <div class="tableXSMN m-b-40">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
                <tr class="bg_xam">
                    <td class="giaiXSMN">
                        <p><?php echo $day;?></p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id1['name'];?></p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id2['name'];?></p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id3['name'];?></p>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải tám
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data1['giai_tam']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data2['giai_tam']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data3['giai_tam']?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải bảy
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data1['giai_bay']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data2['giai_bay']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data3['giai_bay']?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải sáu
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data1['giai_sau_1']?><br /><?php echo $data1['giai_sau_2']?><br /><?php echo $data1['giai_sau_3']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data2['giai_sau_1']?><br /><?php echo $data2['giai_sau_2']?><br /><?php echo $data2['giai_sau_3']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data3['giai_sau_1']?><br /><?php echo $data2['giai_sau_2']?><br /><?php echo $data2['giai_sau_3']?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải năm
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data1['giai_nam']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data2['giai_nam']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data3['giai_nam']?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải tư
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data1['giai_tu_1']?><br /><?php echo $data1['giai_tu_2']?><br /><?php echo $data1['giai_tu_3']?><br /><?php echo $data1['giai_tu_4']?><br /><?php echo $data1['giai_tu_5']?><br /><?php echo $data1['giai_tu_6']?><br /><?php echo $data1['giai_tu_7']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data2['giai_tu_1']?><br /><?php echo $data2['giai_tu_2']?><br /><?php echo $data2['giai_tu_3']?><br /><?php echo $data2['giai_tu_4']?><br /><?php echo $data2['giai_tu_5']?><br /><?php echo $data2['giai_tu_6']?><br /><?php echo $data2['giai_tu_7']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data3['giai_tu_1']?><br /><?php echo $data3['giai_tu_2']?><br /><?php echo $data3['giai_tu_3']?><br /><?php echo $data3['giai_tu_4']?><br /><?php echo $data3['giai_tu_5']?><br /><?php echo $data3['giai_tu_6']?><br /><?php echo $data3['giai_tu_7']?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải ba
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data1['giai_ba_1']?><br /><?php echo $data1['giai_ba_2']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data2['giai_ba_1']?><br /><?php echo $data2['giai_ba_2']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data3['giai_ba_1']?><br /><?php echo $data3['giai_ba_2']?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        Giải hai
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data1['giai_nhi']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data2['giai_nhi']?>
                    </td>
                    <td class="kqXSMN">
                        <?php echo $data3['giai_nhi']?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        Giải nhất
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data1['giai_nhat']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data2['giai_nhat']?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php echo $data3['giai_nhat']?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <p>Giải đặc biệt</p>
                    </td>
                    <td class="kqXSMN">
                        <p class="red"><?php echo $data1['giai_dacbiet']?></p>
                    </td>
                    <td class="kqXSMN">
                        <p class="red"><?php echo $data2['giai_dacbiet']?></p>
                    </td>
                    <td class="kqXSMN">
                        <p class="red"><?php echo $data3['giai_dacbiet']?></p>
                    </td>
                </tr>
            </table>
        </div>

        <?php
            $arr_data1[1]= $data1['giai_dacbiet'];
            $arr_data1[2]= $data1['giai_nhat'];
            $arr_data1[3]= $data1['giai_nhi'];
            $arr_data1[4]= $data1['giai_ba_1'];
            $arr_data1[5]= $data1['giai_ba_2'];
            $arr_data1[6]= $data1['giai_tu_1'];
            $arr_data1[7]= $data1['giai_tu_2'];
            $arr_data1[8]= $data1['giai_tu_3'];
            $arr_data1[9]= $data1['giai_tu_4'];
            $arr_data1[10]= $data1['giai_tu_5'];
            $arr_data1[11]= $data1['giai_tu_6'];
            $arr_data1[12]= $data1['giai_tu_7'];
            $arr_data1[13]= $data1['giai_nam'];
            $arr_data1[14]= $data1['giai_sau_1'];
            $arr_data1[15]= $data1['giai_sau_2'];
            $arr_data1[16]= $data1['giai_sau_3'];
            $arr_data1[17]= $data1['giai_bay'];
            $arr_data1[18]= $data1['giai_tam'];

            $arr_data2[1]= $data2['giai_dacbiet'];
            $arr_data2[2]= $data2['giai_nhat'];
            $arr_data2[3]= $data2['giai_nhi'];
            $arr_data2[4]= $data2['giai_ba_1'];
            $arr_data2[5]= $data2['giai_ba_2'];
            $arr_data2[6]= $data2['giai_tu_1'];
            $arr_data2[7]= $data2['giai_tu_2'];
            $arr_data2[8]= $data2['giai_tu_3'];
            $arr_data2[9]= $data2['giai_tu_4'];
            $arr_data2[10]= $data2['giai_tu_5'];
            $arr_data2[11]= $data2['giai_tu_6'];
            $arr_data2[12]= $data2['giai_tu_7'];
            $arr_data2[13]= $data2['giai_nam'];
            $arr_data2[14]= $data2['giai_sau_1'];
            $arr_data2[15]= $data2['giai_sau_2'];
            $arr_data2[16]= $data2['giai_sau_3'];
            $arr_data2[17]= $data2['giai_bay'];
            $arr_data2[18]= $data2['giai_tam'];
            
            $arr_data3[1]= $data3['giai_dacbiet'];
            $arr_data3[2]= $data3['giai_nhat'];
            $arr_data3[3]= $data3['giai_nhi'];
            $arr_data3[4]= $data3['giai_ba_1'];
            $arr_data3[5]= $data3['giai_ba_2'];
            $arr_data3[6]= $data3['giai_tu_1'];
            $arr_data3[7]= $data3['giai_tu_2'];
            $arr_data3[8]= $data3['giai_tu_3'];
            $arr_data3[9]= $data3['giai_tu_4'];
            $arr_data3[10]= $data3['giai_tu_5'];
            $arr_data3[11]= $data3['giai_tu_6'];
            $arr_data3[12]= $data3['giai_tu_7'];
            $arr_data3[13]= $data3['giai_nam'];
            $arr_data3[14]= $data3['giai_sau_1'];
            $arr_data3[15]= $data3['giai_sau_2'];
            $arr_data3[16]= $data3['giai_sau_3'];
            $arr_data3[17]= $data3['giai_bay'];
            $arr_data3[18]= $data3['giai_tam'];


        ?>

        <div class="tableXSMN">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#e6e6e6">
                <tr class="bg_xam">
                    <td class="giaiXSMN">
                        <p>Đầu</p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id1['name']?></p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id2['name']?></p>
                    </td>
                    <td class="kqXSMN">
                        <p><?php echo $id3['name']?></p>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">0</span>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==0)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==0)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==0)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">1</span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==1)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==1)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==1)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">2</span>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==2)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==2)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==2)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">3</span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==3)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==3)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==3)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">4</span>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==4)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==4)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==4)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">5</span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==5)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==5)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==5)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">6</span>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==6)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==6)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==6)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">7</span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==7)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==7)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==7)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr class="bg_white">
                    <td class="giaiXSMN">
                        <span class="red">8</span>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==8)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==8)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==8)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td class="giaiXSMN bg_white">
                        <span class="red">9</span>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data1);$i++)
                            {
                                if(substr($arr_data1[$i],-2,1)==9)
                                {
                                    echo substr($arr_data1[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data2);$i++)
                            {
                                if(substr($arr_data2[$i],-2,1)==9)
                                {
                                    echo substr($arr_data2[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                    <td class="kqXSMN bg_xam">
                        <?php
                            for($i=1;$i<=count($arr_data3);$i++)
                            {
                                if(substr($arr_data3[$i],-2,1)==9)
                                {
                                    echo substr($arr_data3[$i],-1,1)." ";
                                }
                            }
                        ?>
                    </td>
                </tr>
            </table>
        </div>
        <div class="sms_LOTO">
            <?php echo Yii::app()->params['static_sms'];?>
        </div>
    </div>
    <div class="MXH">
        <a href="javascript:void(0);" onclick="inketqua(2,'<?php echo $data1['ngay_quay']; ?>');" class="boxMXH bogoc">
            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-in.png" class="img_MXH" /> In vé số
        </a>
        <a href="#" class="boxMXH bogoc">
            <img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-in_2.png" class="img_MXH" /> Cách in vé số
        </a>
        <div id="fb-root" style="float: right;"></div>
        <script>(function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=670383849682676&version=v2.0";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
        </script>
        <div class="fb-like" data-href="http://10h.vn/" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
    </div>

    <div class="CHAT">
            
        <div class="titleCHAT">
            Tán Gẫu
        </div>
        
        <div class="CHATarea">
            <textarea name="CHAT" placeholder="Nhập nội dung chat" cols="50" rows="1" class="From"></textarea>
        </div>
        <div style="padding:15px 20px 20px 0; text-align:right;">
            <a href="javascript:void(0);" id="emotion"><img src="<?php echo Yii::app()->params['static_url'];?>images/xo-so-10h-icon-yahoo.png" width="22" height="22" style="padding-right:10px;"></a>
            <a href="javascript:void(0);" onclick="loadChat('<?=$url->createUrl('home/chat')?>');"><img src="<?php echo Yii::app()->params['static_url'];?>images/Refresh.png" width="22" height="22" style="padding-right:10px;" /></a>
            <input type="button" onclick="messenger();" class="button_KQ" value="Gửi">
        </div>

        <div class="boxCHAT" id="CHAT"></div>
        
        <?php $this->renderPartial('boxemotion');?>
        
    </div>

</div>
<div class="rightMain">

    <div class="Box" id="boxsearch"></div>

    <div class="Box" id="boxtienich">
        <?php $this->renderPartial('boxtienich');?>
    </div>

    <div class="Box" id="boxthongke">
        <?php $this->renderPartial('boxthongke');?>
    </div>

        </div>
        <div class="both"></div>
